﻿using System;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Collections;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

using com.fly.sms;

namespace com.fly.sms
{
    public class CustomerAddressBookNumberAddAction : BaseAction
    {
        public CustomerAddressBookNumberAddAction(HttpContext contextTemp)
        {
            this.context = contextTemp;
        }
        public override void excute()
        {
            string AddressBookId = context.Request["AddressBookId"];
            string Name = context.Request["Name"];
            string Sex = context.Request["Sex"];
            string Remark = context.Request["Remark"];
            string DestNumber = context.Request["DestNumber"];
            string[] DestNumberArray = DestNumber.Split(new Char[] { ';' });
            bool rst = false;
            foreach (string mobile in DestNumberArray)
            {
                 rst=CustomerAddressBookDetailService.add(AddressBookId, Name, Sex, Remark, mobile);
            }
            ht.Add("responseCode", "200");
            ht.Add("responseData", rst);
            string json = JsonConvert.SerializeObject(ht);
            context.Response.Write(json);           
        }
    }
}